package com.godz.controller.index3;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.godz.mapper.eduPrimMapper;
import com.godz.mapper.index3EduExpMapper;
import com.godz.pojo.eduPrim;
import com.godz.pojo.index3EduExp;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

@Controller
public class eduController {
    final
    index3EduExpMapper eduExpMapper;//教育经历详细内容
    final
    eduPrimMapper eduPrimMapper;

    public eduController(index3EduExpMapper eduExpMapper, eduPrimMapper eduPrimMapper) {
        this.eduExpMapper = eduExpMapper;
        this.eduPrimMapper = eduPrimMapper;
    }

    @RequestMapping("/index3/educate")
    public String index3edu(Model model, @RequestParam(value = "id") int id){
        //根据另外教育列表得到连接id.查询某教育时期所发生故事
        QueryWrapper<index3EduExp> wrapper = new QueryWrapper<index3EduExp>().eq("id", id);
        index3EduExp eduExp = eduExpMapper.selectOne(wrapper);
        model.addAttribute("eeOve",eduExp.getEeOve());
        model.addAttribute("eeSname",eduExp.getEeSname());

        QueryWrapper<eduPrim> wrapper2 = new QueryWrapper<>();
        wrapper2.eq("ee_linkid",eduExp.getEeLinkid());
        List<eduPrim> prims = eduPrimMapper.selectList(wrapper2);
        model.addAttribute("prims",prims);

        return "index3EduExp";
    }
}
